################################################################################
###
###     Replication for Robustness Checks - 
###     Sanctions, Uncertainty, Leader Tenure
###
###     Authors: Bradley C Smith, William Spaniel
###
###     Created: Nov 6, 2014
###
###     NOTE: To use this file, user must set working directory and load
###           R file "robustness_checks.Rdata" into the workspace.
###           This file reproduces the results found in the online empirical 
###           appendix, which presents robustness checks discussed in the
###           published version of the paper. Data and code for the selection
###           model are also provided in the .zip file.
###
################################################################################

rm(list=ls())

# The user should now load the file "robustness_checks.Rdata" into the workspace.

# Model with minimum estimate for missing tenure cases.
mincheck <- glm(imposition ~
                  logmin +
                  regular +
                  senders +
                  institution +
                  politytrans +
                  cap_2 + 
                  s_un_glo,
                data = data,
                family = binomial(link = logit))
summary(mincheck)

# Model with medium estimate for missing tenure cases
midcheck <- glm(imposition ~
                  logmid +
                  regular +
                  senders +
                  institution +
                  politytrans +
                  cap_2 + 
                  s_un_glo,
                data = data,
                family = binomial(link = logit))
summary(midcheck)

# Model with maximum estimate for missing tenure cases
maxcheck <- glm(imposition ~
                  logmax +
                  regular +
                  senders +
                  institution +
                  politytrans +
                  cap_2 + 
                  s_un_glo,
                data = data,
                family = binomial(link = logit))
summary(maxcheck)


# This model controls for the possibility that the number of senders has an
# interactive effect with the presence of an institution, as shown in 
# Morgan & Miers (2002). Variable "sint" is this interaction term.

interact <- glm(imposition ~
              lndays +
              regular +
              senders +
              institution +
              sint +
              politytrans +
              cap_2 + 
              s_un_glo,
            data = data,
            family = binomial(link = logit))
summary(interact)


# Model with Issue-Area Dummies
issuecheck <- glm(imposition ~
                    lndays +
                    regular +
                    senders +
                    institution +
                    politytrans +
                    cap_2 + 
                    s_un_glo +
                    economic +
                    hrights,
                  data = data,
                  family = binomial(link = logit))
summary(issuecheck)

# The following series of models subsets the data by the type of issue under 
# dispute in a given sanctions episode.

# Run analysis on subset of security related sanctions
issuecheck2 <- glm(imposition ~
                     lndays +
                     regular +
                     senders +
                     institution +
                     politytrans +
                     cap_2 + 
                     s_un_glo,
                   data = data[data$economic+data$hrights==0,],
                   family = binomial(link = logit))
summary(issuecheck2)

# Subset by human rights
issuecheck3 <- glm(imposition ~
                     lndays +
                     regular +
                     senders +
                     institution +
                     politytrans +
                     cap_2 + 
                     s_un_glo,
                   data = data[data$hrights==1,],
                   family = binomial(link = logit))
summary(issuecheck3)


# Subset by sanctions when an economic issue was under dispute

issuecheck4 <- glm(imposition ~
                     lndays +
                     regular +
                     senders +
                     institution +
                     politytrans +
                     cap_2 + 
                     s_un_glo,
                   data = data[data$economic==1,],
                   family = binomial(link = logit))
summary(issuecheck4)




# Run model with less than one year dropped
one <- log10(365)

short      <- glm(imposition ~
                    lndays +
                    regular +
                    senders +
                    institution +
                    politytrans +
                    cap_2 + 
                    s_un_glo,
                  data = data[data$lndays>one,],
                  family = binomial(link = logit))
summary(short)



